package strategy;

import lombok.Data;
import strategy.vo.Ticket;

@Data
public class Context {
    private Strategy strategy;

    private Ticket ticket;

    //这里也可以通过set方法注入ticket和strategy
    public Context(Ticket ticket, Strategy strategy) {
        this.strategy = strategy;
        this.ticket = ticket;
    }

    public double calculate() {

        return strategy.calculate(ticket);
    }

}
